<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{path:'/2-1'}">老师管理</el-breadcrumb-item>
      <el-breadcrumb-item :to="{path:'/2-1'}">老师列表</el-breadcrumb-item>
      <el-breadcrumb-item :to="{path:'/2-1'}">老师查看</el-breadcrumb-item>
    </el-breadcrumb>
    <el-row style="margin-top: 50px"  v-loading="loading">
      <el-col :span="20" :offset="2">
        <el-form :model="tableData" ref="tableData" class="demo-ruleForm" :inline="true">
          <div>
            <el-form-item label="老师头像">
              <img :src="tableData.headImg" class="headimg">
            </el-form-item>
          </div>
          <div>
            <el-form-item label="老师姓名" prop="name">
              <el-input v-model="tableData.name" :disabled="true">
              </el-input>
            </el-form-item>
            <el-form-item label="老师性别" prop="gender">
              <el-input v-model="tableData.gender" :disabled="true">
              </el-input>
            </el-form-item>
          </div>
          <el-form-item label="微信号码" prop="wechatNumber">
            <el-input v-model="tableData.wechatNumber" :disabled="true">

            </el-input>
          </el-form-item>
          <el-form-item label="手机号码" prop="phone">
            <el-input v-model="tableData.phone" :disabled="true"></el-input>
          </el-form-item>
          <div>
            <el-form-item class="center">
              <el-button type="primary" @click="wentback">返回</el-button>
            </el-form-item>
          </div>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
  import axios from 'axios'
  import {
    teachercheck
  } from "@/api/teacher/teacher";

  export default {
    name: "TeacherCheck",
    data() {
      return {
        loading:true,
        tableData: {
          name: '',
          gender: '',
          sex: '',
          wechatNumber: '',
          phone: '',
          headImg: ''
        }
      }
    },
    methods: {
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      },
      wentback() {
        this.$router.push({name: 'TeachList'})
      },
      submit() {
        console.log(this.ruleForm);
      },
      getDetailInfo() {
        localStorage.teacherindex=this.$route.params.index?this.$route.params.index:localStorage.teacherindex;
        let id = this.$route.params.index?this.$route.params.index:localStorage.teacherindex;
        teachercheck(id).then(this.handleGetDataSucc)
      },
      handleGetDataSucc(res) {
        console.log(res);
        this.tableData = res.data;
        this.loading=false;
        switch (this.tableData.sex) {
          case 1:
            this.tableData.gender = '男';
            break;
          case 2:
            this.tableData.gender = '女';
            break;
          case 0:
            this.tableData.gender = '菜鸡赵伟鹏';
            break;
        }
      }
    },
    mounted() {
      console.log(this.$route.params.index);
      this.getDetailInfo();
    }
  }
</script>

<style lang="less" scoped>
  @import "~styles/z.less";
  @import "~styles/css3.less";
  @import "~styles/variables.less";
  .center {
    padding-left: 100px;
  }
  .headimg{
    .headimg
  }
</style>
